package by.demchenko.sample.webapp.page.home.teachers;

import by.demchenko.sample.datamodel.Person;
import by.demchenko.sample.webapp.app.BasicAuthenticationSession;
import by.demchenko.sample.webapp.page.home.BaseLayout;
import by.demchenko.sample.webapp.page.home.cards.ProfileCardPanel;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.image.Image;
import org.apache.wicket.markup.html.link.Link;
import org.apache.wicket.request.resource.PackageResourceReference;


public class TeacherProfilePage extends BaseLayout {

    public TeacherProfilePage() {

        Person teacher = BasicAuthenticationSession.get().getUser();
        add(new Label("fullName", teacher.getFullName()));

        add(new Image("teacherImage", new PackageResourceReference(BaseLayout.class, "/teachers/images/" + teacher.getId() + ".jpg")));

        add(new ProfileCardPanel("profile"));

        add(new Link("createScheduleRecord") {
            @Override
            public void onClick() {
                setResponsePage(new CreateScheduleRecord());
            }
        });
    }
}
